package com.github.wujichen158.andemusic.aboutconfig;

import javax.swing.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class TheMain {
    public static final String PATH = "assets/andemusic/config/modusage.txt";

    public static void main(String[] args) {
        InputStream in = TheMain.class.getClassLoader().getResourceAsStream(PATH);
        List<String> list = new ArrayList<>();
        String total = "";
        if (in != null) {
            try {
                BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
                while (true) {
                    String s = br.readLine();
                    if (s == null) {
                        break;
                    } else {
                        list.add(s);
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        Iterator<String> it = list.iterator();
        while (it.hasNext()) {
            total = total + it.next() + "\r\n";
        }
        if (total.length() > 1) {
            total = total.substring(0, total.length() - 2);
        }
        JOptionPane.showMessageDialog(null, total, "Instructions", -1);
    }
}